﻿using System;
using System.Collections.Generic;
using System.Data.Objects;
using System.Linq;
using System.Text;
using VMDS.Business.Entities;
using VMDS.Data.SQL;

namespace VMDS.Data
{
    
    public interface ICrudEntity<T>
    {
        ICollection<T> GetAll();
        T GetById(int id);
        void Update(T obj);
        void Delete(T obj);
        void Create(T obj);
    }

   
    

    public interface IDataGateway
    {
        ICollection<ClientPC> ClientPC { get; set; }
        ICollection<OS> OS { get; set; }
        ICollection<ScreenShot> Screenshot { get; set; }
        ICollection<Storage> Storage { get; set; }
        ICollection<Subject> Subject { get; set; }
        ICollection<Task> Task { get; set; }
        ICollection<VM> VM { get; set; }
        void SaveChanges();
        void Load();
    }
    public class SqlDataGateway:IDataGateway
    {
        private ModelContainer _db;

        public ICollection<ClientPC> ClientPC { get; set; }
        public ICollection<OS> OS { get; set; }
        public ICollection<ScreenShot> Screenshot { get; set; }
        public ICollection<Storage> Storage { get; set; }
        public ICollection<Subject> Subject { get; set; }
        public ICollection<Task> Task { get; set; }
        public ICollection<VM> VM { get; set; }
        public void SaveChanges()
        {
            _db.SaveChanges();
        }

        public void Load()
        {
            
        }

        void Init()
        {
           
        }
        public SqlDataGateway()
        {
            _db = new ModelContainer();
            Init();
        }
        public SqlDataGateway(string connectionString)
        {
            _db = new ModelContainer(connectionString);
            Init();
        }
    }
}
